import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Main from '../views/Main.vue';
import About from '../views/About.vue';
import SlideList from '../views/slide/SlideList.vue';
import SlideEdit from '../views/slide/SlideEdit.vue';
import ArticleList from '../views/article/ArticleList.vue';
import ArticleEdit from '../views/article/ArticleEdit.vue';
import EquipList from '../views/equip/EquipList.vue';
import EquipEdit from '../views/equip/EquipEdit.vue';
import HeroList from '../views/hero/HeroList.vue';
import HeroEdit from '../views/hero/HeroEdit.vue';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    component: Main,
    children: [
      // 首页
      { name: 'about', path: '/', component: About },
      // 轮播图列表, path 起名字，最好分类清晰
      { name: 'slide-list', path: '/slides/list', component: SlideList},
      { name: 'slide-edit', path: '/slides/edit/:id', component: SlideEdit, props: true},
      { name: 'slide-create', path: '/slides/create/', component: SlideEdit },
      { name: 'article-lise', path: '/articles/list', component: ArticleList },
      { name: 'article-edit', path: '/articles/edit/:id', component: ArticleEdit, props: true },
      { name: 'article-create', path: '/articles/create/', component: ArticleEdit },
      { name: 'equip-list', path: '/equips/list/', component: EquipList },
      { name: 'equip-edit', path: '/equips/edit/:id', component: EquipEdit, props: true },
      { name: 'equip-create', path: '/equips/create/', component: EquipEdit },
      { name: 'hero-list', path: '/heros/list/', component: HeroList },
      { name: 'hero-edit', path: '/heros/edit/:id', component: HeroEdit, props: true },
      { name: 'hero-create', path: '/heros/create/', component: HeroEdit },

      { name: 'about', path: '/about', component: About }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
